package com.ymatou.iapi.couponmanage.testcase;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.couponmanage.parameter.SellerCreateBatchBean;
import com.ymatou.iapi.couponmanage.service.SellerCreateBatchCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponServiceMCallServiceV2;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;

import jdk.nashorn.internal.codegen.CompilerConstants.Call;

/**
*商家创建优惠券批次信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SellerCreateBatch{
	private static SellerCreateBatchBean sellercreatebatchBean;
	private static SellerCreateBatchCall sellercreatebatchCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商家创建优惠券批次信息");
	}

	@Before 
	public void caseUp() {
		sellercreatebatchBean=new SellerCreateBatchBean();
		sellercreatebatchCall=new SellerCreateBatchCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(sellercreatebatchCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_001() {
		Logger.start(true,"商家创建优惠券批次信息-开启无门槛领取");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setSellerId(10545469);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_002() {
		Logger.start(true,"商家创建优惠券批次信息-关闭无门槛领取");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setIsShowOnPage(false);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
		@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_003() {
		Logger.start(true,"商家创建优惠券批次信息-创建优惠券-分享券");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveEndDate(DateTime.now().plusYears(101).toDate());
			sellercreatebatchBean.setCouponType((byte)2);
			sellercreatebatchBean.setEffectiveDays(2);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_035() {
		Logger.start(true,"商家创建优惠券批次信息-创建优惠券-分享券 有效结束时间往后延长100年，变为永久");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveEndDate(DateTime.now().plusYears(99).toDate());
			sellercreatebatchBean.setCouponType((byte)2);
			sellercreatebatchBean.setEffectiveDays(2);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("店铺分享优惠券有效期结束时间必须设置一个较大的时间"), "验证返回的Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_004() {
		Logger.start(true,"商家创建优惠券批次信息-创建优惠券，分享券允许相对有效期，对相对有效期参数进行有效性验证-无效参数,现在改为CouponType<0,则CouponType=1");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)-2);
			sellercreatebatchBean.setEffectiveDays(2);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_018() {
		Logger.start(true,"商家创建优惠券批次信息-优惠券类型不存在-返回：无效参数,现在改为CouponType<0,则CouponType=1");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)-2);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_005() {
		Logger.start(true,"商家创建优惠券批次信息-创建优惠券-分享券-先根据买手Id，最小金额，优惠面额，优惠券类型查询优惠券是否存在存在则直接返回批次编号");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)2);
			sellercreatebatchBean.setEffectiveDays(2);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			      
			String batchCode1 = sellercreatebatchCall.getBatchCode();
			
			sellercreatebatchCall.callService();			
			String batchCode2 = sellercreatebatchCall.getBatchCode();
			
			Logger.verifyEquals(batchCode2,
					batchCode1, "验证返回batchCode一致");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_006() {
		Logger.start(false,"商家创建优惠券批次信息-优惠券面额等于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponAmount(new BigDecimal(0));
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("优惠券面额必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_007() {
		Logger.start(false,"商家创建优惠券批次信息-优惠券面额小于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponAmount(new BigDecimal(-1));
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("优惠券面额必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_008() {
		Logger.start(false,"商家创建优惠券批次信息-订单最小金额小于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setOrderMinAmount(new BigDecimal(-1));
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("订单最小金额必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_009() {
		Logger.start(false,"商家创建优惠券批次信息-订单最小金额等于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setOrderMinAmount(new BigDecimal(0));
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("订单最小金额必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_010() {
		Logger.start(false,"商家创建优惠券批次信息-优惠券总发放数量等于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponTotalCount(0);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("优惠券数量必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_011() {
		Logger.start(false,"商家创建优惠券批次信息-优惠券总发放数量小于0");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponTotalCount(-1);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("优惠券数量必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_SellerCreateBatch_012() {
//		Logger.start(false,"商家创建优惠券批次信息-优惠券总发放数量大于50000-返回：不能超过50000张");
//		try {
//			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
//			sellercreatebatchBean.setCouponTotalCount(50001);
//			sellercreatebatchCall.setData(sellercreatebatchBean);
//			sellercreatebatchCall.callService();			
//			
//			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("总发放数量大于50000"), "验证返回的Message");
//			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
//			
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_013() {
		Logger.start(false,"商家创建优惠券批次信息-优惠券总发放数量等于于50000-返回：成功");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponTotalCount(50000);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_014() {
		Logger.start(false,"商家创建优惠券批次信息-有效期开始日期>有效期结束日期-返回：错误");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			Calendar calendar1 = Calendar.getInstance(); // 得到日历
			calendar1.setTime(dNow);// 把当前时间赋给日历
			calendar1.add(Calendar.DAY_OF_MONTH, 0); // 设置为前一天
			dBefore = calendar1.getTime(); // 得到前一天的时间

			Calendar calendar2 = Calendar.getInstance(); // 得到日历
			calendar2.setTime(dNow);// 把当前时间赋给日历
			calendar2.add(Calendar.DAY_OF_MONTH, 1); // 设置为后十天
			dAfter = calendar2.getTime(); // 得到前一天的时间
			sellercreatebatchBean.setEffectiveStartDate(dAfter);
			sellercreatebatchBean.setEffectiveEndDate(dBefore);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("有效期结束时间必须大于开始时间"), "验证返回的Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_SellerCreateBatch_015() {
		Logger.start(false,"商家创建优惠券批次信息-每人最多能够领取数量大于10-返回：每个批次每人最多可以领取10张(目前不验证)");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setReceiveNumPerUser(11);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_016() {
		Logger.start(false,"商家创建优惠券批次信息-每人最多能够领取数量等于10-返回：成功");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setReceiveNumPerUser(100);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_017() {
		Logger.start(false,"商家创建优惠券批次信息-每人最多能够领取数量等于0-返回：失败");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setReceiveNumPerUser(0);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("每人领取数量必须大于0"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_019() {
		Logger.start(false,"商家创建优惠券批次信息-商家ID为空-返回：失败");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setSellerId(0);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("请传入商家ID"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_020() {
		Logger.start(false,"商家创建优惠券批次信息-有效期开始日期为空-返回：失败");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveStartDate(null);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("请传入有效期开始日期"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_021() {
		Logger.start(false,"商家创建优惠券批次信息-有效期结束日期为空-返回：失败");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveEndDate(null);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("请传入有效期结束日期"), "验证返回的Message");
			Logger.verifyEquals("1", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_022() {
		Logger.start(false,"商家创建优惠券批次信息-有效期开始时间传的值小于1900-01-01-返回：失败-JIRACONN-20931");
		try {
            
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
            String string = "1800-01-01 00:00:00";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date dNow=sdf.parse(string);
			sellercreatebatchBean.setEffectiveStartDate(dNow);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("有效期开始时间错误"), "验证返回的Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回的StatusCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_023() {
		Logger.start(true,"商家创建优惠券批次信息-验证优惠券类型：平台活动买手券coupontype=3,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_024() {
		Logger.start(true,"商家创建优惠券批次信息-验证如果已存在买手Id + 活动Id + 满足金额 + 优惠券面额的优惠券，则不创建直接返回成功,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();	
			List<Map>  map1= new couponbatchWapper().selectBy(MapUtil.hashMap("OperatorId",sellercreatebatchBean.getSellerId()
					 ,"CouponTypeBizValue",sellercreatebatchBean.getCouponTypeBizValue()
					 ,"MinOrderValue",sellercreatebatchBean.getOrderMinAmount()
					 ,"CouponValue",sellercreatebatchBean.getCouponAmount()));
			sellercreatebatchCall.callService();
			
			List<Map>  map2= new couponbatchWapper().selectBy(MapUtil.hashMap("OperatorId",sellercreatebatchBean.getSellerId()
					 ,"CouponTypeBizValue",sellercreatebatchBean.getCouponTypeBizValue()
					 ,"MinOrderValue",sellercreatebatchBean.getOrderMinAmount()
					 ,"CouponValue",sellercreatebatchBean.getCouponAmount()));
			Logger.verifyEquals(0, map2.size()-map1.size(), "验证数据库couponbatch没有新增数据");
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_025() {
		Logger.start(true,"商家创建优惠券批次信息-验证如果已存在买手Id + 活动Id ，可以创建直接返回成功,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			//第一次执行
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();	

			//第二次执行
			sellercreatebatchBean.setOrderMinAmount(BigDecimal.valueOf(10));
			sellercreatebatchBean.setCouponAmount(BigDecimal.valueOf(1));
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();
			
			List<Map>  map2= new couponbatchWapper().selectBy(MapUtil.hashMap("OperatorId",sellercreatebatchBean.getSellerId()
					 ,"CouponTypeBizValue",sellercreatebatchBean.getCouponTypeBizValue()));
			Logger.verifyEquals(2, map2.size(), "验证数据库couponbatch新增两条数据");
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_026() {
		Logger.start(false,"商家创建优惠券批次信息-验证优惠券类型：平台活动买手券,但是活动id为空,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			sellercreatebatchBean.setCouponType((byte)3);
			//sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("未提供平台活动Id"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_027() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取开始时间 < 有效开始时间,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 3); 
			dvalidEnd = calendar4.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_028() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取开始时间 > 有效开始时间,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 3); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 4); 
			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 4); 
			dvalidEnd = calendar4.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_029() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取开始时间 > 领取结束时间 ,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 1); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 0); 
			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 1); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidEnd = calendar4.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("领取开始时间不能晚于领取结束时间"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_030() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取结束时间> 有效结束时间 ,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 1); 
			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 2); 
			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 0); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 0); 
			dvalidEnd = calendar4.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("领取结束时间不能大于使用结束时间"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_031() {
		Logger.start(true,"商家创建优惠券批次信息-验证未提供领取开始时间,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
//			Date dBefore = new Date();
//			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
//			Calendar calendar1 = Calendar.getInstance(); 
//			calendar1.setTime(dNow);
//			calendar1.add(Calendar.DAY_OF_MONTH, 0); 
//			dBefore = calendar1.getTime(); 
//
//			Calendar calendar2 = Calendar.getInstance(); 
//			calendar2.setTime(dNow);
//			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
//			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 3); 
			dvalidEnd = calendar4.getTime(); 
			
			sellercreatebatchBean.setAcquireStartTime(null);
			sellercreatebatchBean.setAcquireEndTime(null);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("未提供领取开始时间"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_032() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取开始时间错误,领取开始时间<1900-01-01, ,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
		//	Date dBefore = new Date();
			Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
//			Calendar calendar1 = Calendar.getInstance(); 
//			calendar1.setTime(dNow);
//			calendar1.add(Calendar.DAY_OF_MONTH, 1); 
//			dBefore = calendar1.getTime(); 

			Calendar calendar2 = Calendar.getInstance(); 
			calendar2.setTime(dNow);
			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 3); 
			dvalidEnd = calendar4.getTime(); 
			
			 Date minStartTime = DateTime.parse("1800-01-01", DateTimeFormat.forPattern("yyyy-MM-dd")).toDate();
			 
			sellercreatebatchBean.setAcquireStartTime(minStartTime);
			sellercreatebatchBean.setAcquireEndTime(dAfter);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("领取开始时间错误"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_033() {
		Logger.start(true,"商家创建优惠券批次信息-验证未提供领取结束时间, ,JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			//Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, 1); 
			dBefore = calendar1.getTime(); 
//
//			Calendar calendar2 = Calendar.getInstance(); 
//			calendar2.setTime(dNow);
//			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
//			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 3); 
			dvalidEnd = calendar4.getTime(); 
			 
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(null);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("未提供领取结束时间"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_034() {
		Logger.start(true,"商家创建优惠券批次信息-验证领取结束时间不能小于当前时间, JIRACONN-23166");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();
			//Date dAfter = new Date();
			Date dvalidStar = new Date();
			Date dvalidEnd = new Date();
			
			Calendar calendar1 = Calendar.getInstance(); 
			calendar1.setTime(dNow);
			calendar1.add(Calendar.DAY_OF_MONTH, -1); 
			dBefore = calendar1.getTime(); 
//
//			Calendar calendar2 = Calendar.getInstance(); 
//			calendar2.setTime(dNow);
//			calendar2.add(Calendar.DAY_OF_MONTH, 1); 
//			dAfter = calendar2.getTime(); 
			
			Calendar calendar3 = Calendar.getInstance(); 
			calendar3.setTime(dNow);
			calendar3.add(Calendar.DAY_OF_MONTH, 2); 
			dvalidStar = calendar3.getTime(); 
			
			Calendar calendar4 = Calendar.getInstance(); 
			calendar4.setTime(dNow);
			calendar4.add(Calendar.DAY_OF_MONTH, 3); 
			dvalidEnd = calendar4.getTime(); 
			 
			sellercreatebatchBean.setAcquireStartTime(dBefore);
			sellercreatebatchBean.setAcquireEndTime(dNow);
			
			sellercreatebatchBean.setEffectiveStartDate(dvalidStar);
			sellercreatebatchBean.setEffectiveEndDate(dvalidEnd);
			
			sellercreatebatchBean.setCouponType((byte)3);
			sellercreatebatchBean.setCouponTypeBizValue("1");
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			Logger.verifyEquals(true, sellercreatebatchCall.getMessage().contains("领取结束时间不能小于当前时间"), "验证返回Message");
			Logger.verifyEquals("2", sellercreatebatchCall.getCode(), "验证返回errorCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_036() {
		Logger.start(true,"商家创建优惠券批次信息-直播时优惠券");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)4);
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_037() {
		Logger.start(true,"商家创建优惠券批次信息-开启无门槛领取");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setSellerId(303713);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SellerCreateBatch_038() {
		Logger.start(true,"商家创建优惠券批次信息-特殊用户批次编码用数字+字母");
		try {
			sellercreatebatchBean = new CouponServiceMCallServiceV2().setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setSellerId(303713);
			
			sellercreatebatchCall.setData(sellercreatebatchBean);
			sellercreatebatchCall.callService();			
			
			VerifyReturnDataBase();
			
	        //新增 20200413 验证优惠券批次仅含有数字和字母,platformBatchCodeSwitch sit环境配置在disconfig
	        boolean platformBatchCodeSwitch =Boolean.parseBoolean(EnvSetup.getData("platformBatchCodeSwitch").toString());
	        String CHINESE_LETTER_DIGIT_REGEX = "^[a-z0-9A-Z\u4e00-\u9fa5]+$";
	        String batchCode=sellercreatebatchCall.getBatchCode();
	        if(platformBatchCodeSwitch==true)
	        {
		        Logger.verifyEquals(true, batchCode.length()==10, "验证优惠券长度是10");
		        Logger.verifyEquals(true, batchCode.matches(CHINESE_LETTER_DIGIT_REGEX), "验证优惠券批次包括字符串和数字");
	        }
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public void VerifyReturnDataBase() throws ParseException {
		// 验证返回
		Logger.verifyEquals("0", sellercreatebatchCall.getCode(), "验证返回Code");
		Logger.verifyEquals("操作成功！",
				sellercreatebatchCall.getMessage(), "验证返回MessageText");

		// 验证couponbatch表
		String sBatchCode = sellercreatebatchCall.getBatchCode();
		List<couponbatch> list = new couponbatchWapper()
				.selectBybatchCode(sBatchCode);

		Logger.verifyEquals(1, list.size(), "验证couponbatch表生成sBatchCode="
				+ sBatchCode + "的条数。");

		if (list.size() >= 1) {
            couponbatch    item = list.get(0);
			Logger.verifyEquals(sellercreatebatchBean.getBatchName(),
					item.getCouponName(), "验证数据库couponbatch表中BatchCode="
							+ sBatchCode + "的记录中CouponName");
			Logger.verifyEquals(sellercreatebatchBean.getSellerId(),
					item.getOperatorId(), "验证数据库couponbatch表中sBatchCode="
							+ sBatchCode + "的记录中iOperatorId");
			Logger.verifyEquals(sellercreatebatchBean.getCouponTotalCount(),
					item.getTotalNum(),
					"验证数据库couponbatch表中sBatchCode=" + sBatchCode
							+ "的记录中iCouponTotalNum");
			Logger.verifyEquals(sellercreatebatchBean.getReceiveNumPerUser(),
					item.getReceiveTimesPerUser(),
					"验证数据库couponbatch表中sBatchCode=" + sBatchCode
							+ "的记录中iCouponNumPerUser");
			if(sellercreatebatchBean.getCouponType()==4)
				Logger.verifyEquals(item.getIsShowInPage(),
						false,
						"验证数据库couponbatch表中sBatchCode=" + sBatchCode
								+ "的记录中IsShowOnPage");
			else
				Logger.verifyEquals(sellercreatebatchBean.getIsShowOnPage(),
					item.getIsShowInPage(),
					"验证数据库couponbatch表中sBatchCode=" + sBatchCode
							+ "的记录中IsShowOnPage");
			//int type=item.getAcquireMethod()==3?2:1;
			Logger.verifyEquals((int)sellercreatebatchBean.getCouponType()<0?1:(int)sellercreatebatchBean.getCouponType(),
					item.getCouponType(), "验证数据库couponbatch表中sBatchCode="
							+ sBatchCode + "的记录中coupontype");
			
			SimpleDateFormat formatter = new SimpleDateFormat(
					"yyyy-MM-dd HH:mm:ss");
			Logger.verifyEquals(
					formatter.format(sellercreatebatchBean.getEffectiveStartDate()),
					formatter.format(item.getValidStart()),
					"验证数据库couponbatch表中BatchId="
							+ item.getBatchId()
							+ "的记录中ValidStart");
			
			SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd");
			Date endDate = formatter.parse(formatter2
					.format(sellercreatebatchBean.getEffectiveEndDate()) + " 23:59:59");
			if(sellercreatebatchBean.getCouponType()==4)
			{
				long times=new DateTime(sellercreatebatchBean.getEffectiveEndDate()).toLocalDate().plusDays(1).toDate().getTime();
				 endDate = formatter.parse(formatter2
						.format(times) + " 23:59:59");
			}	
			Logger.verifyEquals(
						formatter.format(endDate),
						formatter.format(item.getExpiredDate()),
						"验证数据库couponbatch表中BatchId="
								+ item.getBatchId()
								+ "的记录中ExpiredDate");
			Logger.verifyEquals(sellercreatebatchBean
					.getCouponAmount(),
					new BigDecimal(item.getCouponValue()
							.floatValue()),
					"验证数据库Ymt_CouponValue表中BatchId="
							+ item.getBatchId()
							+ "的记录中的CouponValue");
			Logger.verifyEquals(sellercreatebatchBean
					.getOrderMinAmount(),
					new BigDecimal(item.getMinOrderValue()
							.floatValue()),
					"验证数据库Ymt_CouponValue表中BatchId="
							+ item.getBatchId()
							+ "的记录中的MinOrderValue");
			//新增
			if(sellercreatebatchBean.getCouponType()==(byte)4){
				Logger.verifyEquals(1,item.getEffectiveTimeType(),
						"验证买手直播优惠券 对应数据库couponbatch表中sBatchCode=" + sBatchCode
								+ "的记录中EffectiveTimeType");
				Logger.verifyEquals(12,item.getEffectiveDays(),
						"验证买手直播优惠券 对应数据库couponbatch表中sBatchCode=" + sBatchCode
								+ "的记录中EffectiveDays");
				
				Logger.verifyEquals(11,item.getUseConditionType(),
						"验证买手直播优惠券 对应数据库couponbatch表中sBatchCode=" + sBatchCode
								+ "的记录中UseConditionType");
				
				Logger.verifyEquals(4,item.getCouponType(),
						"验证买手直播优惠券 对应数据库couponbatch表中sBatchCode=" + sBatchCode
								+ "的记录中CouponType");
			}
		}
	}
}